package com.itheima.tanhua.web;


import com.itheima.tanhua.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 登录
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService user1Service;

    @PostMapping("/login")
    public ResponseEntity login(@RequestBody Map<String,String> param){
           user1Service.sendMsg(param.get("phone"));
        return ResponseEntity.ok(null);

    }

    @PostMapping("/loginVerification")
    public ResponseEntity Verification(@RequestBody Map<String,String> param){
        Map map = user1Service.Verification(param);
        return ResponseEntity.ok(map);
    }

    @GetMapping("/{token}")
    public Long getBytoken(@PathVariable String token){
       return user1Service.tokenCheck(token);
    }


}
